/*
 * Equipment.h
 *
 *  Created on: Jun 16, 2012
 *      Author: gonzalo
 */

#ifndef USEREQUIPMENT_H_
#define USEREQUIPMENT_H_

#include "../Widget.h"
#include "bonus/Bonus.h"
#include "equipment/Equipment.h"
#include "equipment/EquipmentUserInfo.h"
#include "equipment/EquipmentInvisible.h"

class UserEquipment: public Widget {
public:
	UserEquipment(std::string playerName, Widget *parent);
	void addBonus(Bonus* bonus);

	void handleEvent(Event event);
	void resolve();
	void showOn(SDL_Surface* surface);
	void drawEquipment(SDL_Surface* surface,int offsetX,int offsetY);
	void reduceLife(int value,playElement element);

	int getUserLife();
	std::string getPlayerName();

	void initEquipment(int ship_life);
	void updateEquipments(std::list<DTOEquipment*> equipments);

	void addToBonusList(Bonus* newBonus);

	virtual ~UserEquipment();

	std::list<DTOEquipment*> getDTO();

	void resetBonusList();

    EquipmentInvisible *getInvisibilidad() const;

private:
	void arrangeBonusList();

	void addToEquipment(std::pair<Equipment*,Bonus*>* pair);

	std::list< std::pair<Equipment*,Bonus*>* > equipmentAvailable;

	EquipmentUserInfo* userInfo;

	EquipmentInvisible* invisibilidad;

	std::string playerName;
};

#endif /* USEREQUIPMENT_H_ */
